home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sun Solutions 2000 #2
/
Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO
/
products
/
bin
/
update.csh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
2000-01-05
|
20KB
|
515 lines
#! /bin/csh
#
# Create the category pages seen in the categories.txt file
#
# check if root user
setenv USER `/usr/ucb/whoami`
if ( "$USER" != "root" ) then
echo " "
echo "This program must be run as root user."
echo " "
exit 1
endif
setenv CATS false
setenv APPLETS false
setenv COMP false
setenv PROD false
setenv PLATFORM sparc
# parse command line arguements
setenv ARGC `echo $argv|wc -w`
# only check command line options if they exist
if ( $ARGC ) then
foreach OPTION ($*)
echo "OPTION = "$OPTION
# check if the current option is the source image directory name
# if ( $SRC_DIR == $NOT_DEFAULT ) then
# setenv SRC_DIR $OPTION
# echo "Using $SRC_DIR as the target directory."
# check if the option is really a directory
# if ( ! -d $SRC_DIR ) then
# echo "$SRC_DIR is not a directory."
# exit 1
# endif
# endif
switch ($OPTION)
case '-cats' :
setenv CATS true
breaksw
case '-applets' :
setenv APPLETS true
breaksw
case '-comp' :
setenv COMP true
breaksw
case '-prod' :
setenv PROD true
breaksw
case '-all' :
setenv PROD true
setenv COMP true
setenv APPLETS true
setenv CATS true
breaksw
case '-x86' :
setenv PLATFORM x86
setenv SRC_DIR ../../../x86.image
breaksw
default :
echo "Usage: update.csh [ -cats | -applets | -comp | -prod | -all | -x86 ]"
exit 0
breaksw
endsw
end
else
setenv PROD true
setenv COMP true
setenv APPLETS true
setenv CATS true
endif
#
# Category creation bases on categories.txt file
#
if ( $CATS == "true" ) then
mv ../.categories/Software.html /tmp
mv ../.categories/companies.html /tmp
mv ../.categories/products.html /tmp
rm ../.categories/*
mv /tmp/Software.html ../.categories
mv /tmp/companies.html ../.categories
mv /tmp/products.html ../.categories
echo "Creating category pages ..."
foreach cats ( `cat categories.txt` )
set catword = $cats
foreach comp ( `ls ../` )
if ( ! -e ../$comp/_info ) then
echo " $comp : no _info file"
endif
if (-e ../$comp/_info ) then
touch dbase.tmp
nawk -F^ ' BEGIN { } \
{ \
if ( $4 ~ /'"$catword"'/ ) print ""$1"^"$2"^'"$comp"'^" \
}' ../$comp/_info >> ./dbase.tmp
endif
end
#
# make text page
#
echo ""
echo " Creating $catword category page ..."
echo ""
set letter = "A"
#
# Place appropriate applet reference in Hardware & Services
#
switch ( "$catword" )
case "Hardware":
cat hard.head > ../.categories/$catword.html
breaksw
case "Services":
cat serve.html > ../.categories/$catword.html
breaksw
default:
cat head.html > ../.categories/$catword.html
endsw
#
# make a switch statement to convert sun to sun information, etc.
#
echo "<H1>$catword </H1>" >> ../.categories/$catword.html
echo "</pre>" >> ../.categories/$catword.html
echo "<DL>" >> ../.categories/$catword.html
echo '<B><FONT size="-1">' >> ../.categories/$catword.html
echo '<B>Search for--</b><A HREF="./'$catword'#A">A</A> <A HREF="./'$catword'#B">B</A> <A HREF="./'$catword'#C">C</A> <A HREF="./'$catword'#D">D</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#E">E</A> <A HREF="./'$catword'#F">F</A> <A HREF="./'$catword'#G">G</A> <A HREF="./'$catword'#H">H</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#I">I</A> <A HREF="./'$catword'#J">J</A> <A HREF="./'$catword'#K">K</A> <A HREF="./'$catword'#L">L</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#M">M</A> <A HREF="./'$catword'#N">N</A> <A HREF="./'$catword'#O">O</A> <A HREF="./'$catword'#P">P</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#Q">Q</A> <A HREF="./'$catword'#R">R</A> <A HREF="./'$catword'#S">S</A> <A HREF="./'$catword'#T">T</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#U">U</A> <A HREF="./'$catword'#V">V</A> <A HREF="./'$catword'#W">W</A> <A HREF="./'$catword'#X">X</A>' >> ../.categories/$catword.html
echo '<A HREF="./'$catword'#Y">Y</A> <A HREF="./'$catword'#Z">Z</A>' >> ../.categories/$catword.html
echo '</FONT></B>' >> ../.categories/$catword.html
echo '<hr>' >> ../.categories/$catword.html
echo '<p>' >> ../.categories/$catword.html
nawk -F^ ' BEGIN {i=65;s=0;letter ="^A.*";rletter = "A"} {\
comp = $1;$7 = $1;href = gsub (/ /,"",$7) \
if ( comp !~ letter ) {\
for ( x=i;x<=100; ++x ){\
letter = sprintf("^%c.*", x)\
rletter = sprintf("%c", x)\
if ( comp ~ letter ) {i=x;s=0;break}\
}\
}\
if ( comp ~ letter && s==0 ) {\
print "<DT><A NAME=\""rletter"\"><B><B>"rletter"</B></B></A><br><DD><a href=http://localhost:7999/"$3"><B>"$1"</B></a>"$2"<br>";s=2 \
}\
if ( comp ~ letter && s==1) {\
print " <DD><a href=http://localhost:7999/"$3"><B>"$1"</B></a>"$2"<br>"\
}\
s=1\
}' dbase.tmp >> ../.categories/$catword.html
cat tail.html >> ../.categories/$catword.html
rm dbase.tmp
end
endif
#
# Get all CDware menu bar components and put in file
# for building of front page applet
#
if ( $APPLETS == "true" ) then
echo ""
echo "Building Control bar applets ..."
echo ""
# If first line contains applet (ours), strip the applet
echo " Removing old applets ..."
foreach comp (`ls ../`)
touch $comp.tmp
nawk 'BEGIN {s=0} {\
if ( $0 ~ "<app" && NR ==1 ) { \
s=1; break }\
if ( s==0 ) { print $0 } \
if ( $0 ~ ">" ) { s=0 }\
}' ../$comp/index.html >> $comp.tmp
mv $comp.tmp ../$comp/index.html
end
# see what each company has, build the tagRef to the applet accordingly
echo " Creating new applets ..."
setenv CDOPT
foreach comp (`ls ../`)
if ( ! -e ../$comp/_info ) then
echo " $comp : no _info file"
endif
rm applet
touch applet
touch temp
if ( -e ../$comp/_info ) then
setenv CDOPT `nawk -F^ ' BEGIN {s=0} { if ( $3 ~ /testdrive/ ) { s=1 } if ( $3 ~ /install/ ) { s=(s+2) } if ( $3 ~ /demo/ ) { s=(s+4) } } END { print s }' ../$comp/_info`
switch ( "$CDOPT" )
case "8":
echo "WARNING: no applet for $comp ..."
breaksw
case "0":
echo '<app class=CDbar img="../CDware/images/none.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo ">" >> applet
breaksw
case "1":
echo '<app class=CDbar img="../CDware/images/td.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,400,1,95,33,http://localhost:7999/$comp/_install/run.sh" >> applet
echo ">" >> applet
breaksw
case "2":
echo '<app class=CDbar img="../CDware/images/ts.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,496,1,96,33,http://localhost:7999/$comp/_install/install.sh" >> applet
echo ">" >> applet
breaksw
case "3":
echo '<app class=CDbar img="../CDware/images/tdts.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,400,1,95,33,http://localhost:7999/$comp/_install/run.sh" >> applet
echo "area5=HrefButtonArea,496,1,96,33,http://localhost:7999/$comp/_install/install.sh" >> applet
echo ">" >> applet
breaksw
case "4":
echo '<app class=CDbar img="../CDware/images/rd.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,304,1,93,33,http://localhost:7999/$comp/_install/install_show.sh" >> applet
echo ">" >> applet
breaksw
case "5":
echo '<app class=CDbar img="../CDware/images/tdrd.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,304,1,93,33,http://localhost:7999/$comp/_install/install_show.sh" >> applet
echo "area5=HrefButtonArea,400,1,95,33,http://localhost:7999/$comp/_install/run.sh" >> applet
echo ">" >> applet
breaksw
case "6":
echo '<app class=CDbar img="../CDware/images/tsrd.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,304,1,93,33,http://localhost:7999/$comp/_install/install_show.sh" >> applet
echo "area5=HrefButtonArea,496,1,96,33,http://localhost:7999/$comp/_install/install.sh" >> applet
echo ">" >> applet
breaksw
case "7":
echo '<app class=CDbar img="../CDware/images/samplebar.gif"' >> applet
echo "highlight=brighter60" >> applet
echo "area1=HrefButtonArea,4,1,93,33,../CDware/index.html" >> applet
echo "area2=HrefButtonArea,98,1,97,33,../.wais/Catalog.html" >> applet
echo "area3=HrefButtonArea,197,1,95,33,http://localhost:7999/cgi-bin/req_more_info.pl?$comp" >> applet
echo "area4=HrefButtonArea,304,1,93,33,http://localhost:7999/$comp/_install/install_show.sh" >> applet
echo "area5=HrefButtonArea,400,1,95,33,http://localhost:7999/$comp/_install/run.sh" >> applet
echo "area6=HrefButtonArea,496,1,96,33,http://localhost:7999/$comp/_install/install.sh" >> applet
echo ">" >> applet
breaksw
default:
echo " WARNING: There is no applet for $comp"
endsw
nawk ' {print $0} ' applet ../$comp/index.html >> temp
mv temp ../$comp/index.html
endif
end
endif
#
# Compile list of companies, place in 'companies' file
#
if ( $COMP == true ) then
echo ""
echo "Compiling Company Names ..."
echo ""
touch comp.tmp
foreach comp (`ls ../`)
set old_dir = `pwd`
cd ../$comp
if ( -e _info ) then
set NUM_PROD = `wc -l _info | sed -e 's/^ *//' | cut -f1 -d" "`
nawk -F^ 'BEGIN {s=0} {if ( NR == 1 ) {\
printf ("%s^%s^'$comp'^",$1,$2)\
} }' _info >> ../.bin/comp.tmp
nawk -F^ 'BEGIN {s=0} { if ( NR !=1 ) { printf ("%s",$1)}\
if ( NR <= ("'$NUM_PROD'" - 1 ) && NR != 1) {printf ("\, ")} } END { printf ("^\n")} ' _info >> ../.bin/comp.tmp
endif
cd $old_dir
end
sort -o companies comp.tmp
# make text page
echo ""
echo " Creating Companies page ..."
echo ""
set letter = "A"
cat head.html > ../.categories/companies.html
echo '<app class=CDbar img="../CDware/images/companies.gif"' >> ../.categories/companies.html
echo 'highlight=brighter60' >> ../.categories/companies.html
echo 'area1=HrefButtonArea,27,4,69,40,../.categories/services.html' >> ../.categories/companies.html
echo 'area2=HrefButtonArea,27,36,69,90,../.categories/products.html' >> ../.categories/companies.html
echo 'area3=HrefButtonArea,96,0,69,40,../.categories/Hardware.html' >> ../.categories/companies.html
echo 'area4=HrefButtonArea,96,38,69,74,../.categories/Software.html>' >> ../.categories/companies.html
echo '<DL>' >> ../.categories/companies.html
echo '<B><FONT size="-1">' >> ../.categories/companies.html
echo '<B>Search for--</b><A HREF="./companies.html#A">A</A> <A HREF="./companies.html#B">B</A> <A HREF="./companies.html#C">C</A> <A HREF="./companies.html#D">D</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#E">E</A> <A HREF="./companies.html#F">F</A> <A HREF="./companies.html#G">G</A> <A HREF="./companies.html#H">H</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#I">I</A> <A HREF="./companies.html#J">J</A> <A HREF="./companies.html#K">K</A> <A HREF="./companies.html#L">L</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#M">M</A> <A HREF="./companies.html#N">N</A> <A HREF="./companies.html#O">O</A> <A HREF="./companies.html#P">P</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#Q">Q</A> <A HREF="./companies.html#R">R</A> <A HREF="./companies.html#S">S</A> <A HREF="./companies.html#T">T</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#U">U</A> <A HREF="./companies.html#V">V</A> <A HREF="./companies.html#W">W</A> <A HREF="./companies.html#X">X</A>' >> ../.categories/companies.html
echo '<A HREF="./companies.html#Y">Y</A> <A HREF="./companies.html#Z">Z</A>' >> ../.categories/companies.html
echo '</FONT></B>' >> ../.categories/companies.html
echo '<hr>' >> ../.categories/companies.html
echo '<p>' >> ../.categories/companies.html
nawk -F^ ' BEGIN {i=65;s=0;letter ="^A.*";rletter = "A"} {\
comp = $1; \
if ( comp !~ letter ) {\
for ( x=i;x<=100; ++x ){\
letter = sprintf("^%c.*", x)\
rletter = sprintf("%c", x)\
if ( comp ~ letter ) {i=x;s=0;break}\
}\
}\
if ( comp ~ letter && s==0 ) {\
printf ("<DT><A NAME=\""rletter"\"><B><B>"rletter"</B></B></A><DD><a href=http://localhost:7999/"$3"><B>"$1"</B></a>"$2"")\
print "<dd><b><i>"$4"</i></b><br>" ;s=2 \
}\
if ( comp ~ letter && s==1) {\
print " <DD><a href=http://localhost:7999/"$3"><B>"$1"</B></a>"$2""\
print "<dd><b><i>"$4"</i></b><br>" \
}\
s=1\
}' comp.tmp >> ../.categories/companies.html
cat tail.html >> ../.categories/companies.html
rm comp.tmp
endif
#
# Compile list of products, place in 'products' file
#
if ( $PROD == true ) then
echo ""
echo "Compiling Products ..."
echo ""
touch prod.tmp
foreach comp (`ls ../`)
if ( -e ../$comp/_info ) then
nawk -F^ 'BEGIN {s=0} { \
if ( NR == 1 ) { company = $1 } \
if ( NR !=1 ) { print ""$1"^'$comp'^"company"^" } }' ../$comp/_info >> prod.tmp
endif
end
sort -f -o products prod.tmp
echo " Creating Products page ..."
echo ""
set letter = "A"
cat head.html > ../.categories/products.html
echo '<app class=CDbar img="../CDware/images/products.gif"' >> ../.categories/products.html
echo 'highlight=brighter60' >> ../.categories/products.html
echo 'area1=HrefButtonArea,27,4,69,40,../.categories/companies.html' >> ../.categories/products.html
echo 'area2=HrefButtonArea,27,36,69,90,../.categories/services.html' >> ../.categories/products.html
echo 'area3=HrefButtonArea,96,0,69,40,../.categories/Hardware.html' >> ../.categories/products.html
echo 'area4=HrefButtonArea,96,38,69,74,../.categories/Software.html>' >> ../.categories/products.html
echo "<DL>" >> ../.categories/products.html
echo '<B><FONT size="-1">' >> ../.categories/products.html
echo '<B>Search for--</b><A HREF="./products.html#A">A</A> <A HREF="./products.html#B">B</A> <A HREF="./products.html#C">C</A> <A HREF="./products.html#D">D</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#E">E</A> <A HREF="./products.html#F">F</A> <A HREF="./products.html#G">G</A> <A HREF="./products.html#H">H</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#I">I</A> <A HREF="./products.html#J">J</A> <A HREF="./products.html#K">K</A> <A HREF="./products.html#L">L</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#M">M</A> <A HREF="./products.html#N">N</A> <A HREF="./products.html#O">O</A> <A HREF="./products.html#P">P</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#Q">Q</A> <A HREF="./products.html#R">R</A> <A HREF="./products.html#S">S</A> <A HREF="./products.html#T">T</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#U">U</A> <A HREF="./products.html#V">V</A> <A HREF="./products.html#W">W</A> <A HREF="./products.html#X">X</A>' >> ../.categories/products.html
echo '<A HREF="./products.html#Y">Y</A> <A HREF="./products.html#Z">Z</A>' >> ../.categories/products.html
echo '</FONT></B>' >> ../.categories/products.html
echo '<hr>' >> ../.categories/products.html
echo '<p>' >> ../.categories/products.html
nawk -F^ ' BEGIN {i=65;s=0;lowcase ="^a.*";letter ="^A.*";rletter = "A"} {\
comp = $1; \
if ( comp !~ letter && comp !~ lowcase ) {\
for ( x=i;x<=100; ++x ){\
l = (x + 32)\
letter = sprintf("^%c.*", x)\
lowcase = sprintf("^%c.*", l)\
rletter = sprintf("%c", x)\
if ( comp ~ letter || comp ~ lowcase ) {i=x;s=0;break}\
}\
}\
if ( (comp ~ letter || comp ~ lowcase ) && s==0 ) {\
printf ("<DT><A NAME=\""rletter"\"><B><B>"rletter"</B></B></A><DD><a href=http://localhost:7999/"$2"><B>"$1 "</B></a><i> from </i><b>"$3"</b>")\
print "<br>" ;s=2 \
}\
if ( (comp ~ letter || comp ~ lowcase) && s==1) {\
print " <DD><a href=http://localhost:7999/"$2"><B>"$1 "</B></a><i> from </i><b>"$3"</b>"\
print "<br>" \
}\
s=1\
}' products >> ../.categories/products.html
cat tail.html >> ../.categories/products.html
rm prod.tmp
endif